home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 15527 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  808 b 

  1. Path: news.cc.sunysb.edu!usenet
  2. From: dkat@psych1.psy.sunysb.edu (DK)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: help rand !
  5. Date: Fri, 19 Apr 1996 19:44:43 GMT
  6. Organization: State University of New York at Stony Brook
  7. Message-ID: <4l8f4d$i2s@abel.cc.sunysb.edu>
  8. References: <4l5d75$mes@usenetp1.news.prodigy.com> <4l5fj4$1ehs@serra.unipi.it> <4l5vjm$5lj@ccshst05.uoguelph.ca> <4l7bnt$r44@griffin.itc.gu.edu.au>
  9. NNTP-Posting-Host: catsam.psy.sunysb.edu
  10. X-Newsreader: Forte Free Agent 1.0.82
  11.  
  12.  
  13. >swap n[1] with n[rand]
  14. >swap n[2] with n[rand]
  15. >......................
  16. >swap n[10] with n[rand]
  17. /* don't forget to mod rand() (n[(rand()%12)]) so you don't overwrite
  18. your buffer - or >> shift and mask - DK*/    
  19. >after:        n[1] = 9
  20. >        n[2] = 3
  21. >          :    :
  22. >        n[10]= 6
  23.  
  24. >This ain't that great, but it will work predictably.
  25.  
  26.  
  27.